package wzh.crm.ui.customer;

import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.view.View;

import wzh.crm.R;
import wzh.crm.ui.DisplayListItemView;
import wzh.crm.ui.contact.ContactDetailsActivity;
import wzh.crm.vo.CustomerVo;

/**
 * Created by wangzehao on 2016/5/23.
 */
public class CustomerListItem extends DisplayListItemView<CustomerVo> {
    public CustomerListItem(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public void setModel(final CustomerVo model) {
        try {
            setTitle(getContext().getResources().getStringArray(R.array.客户类型)[model.get客户类型()-1]);
        }catch (Exception e){
            setTitle(getContext().getResources().getStringArray(R.array.客户类型)[model.get客户类型()]);
        }
        
        setDetail(model.get客户名称());

        this.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i=new Intent(getContext(),CustomerOverviewActivity.class);
                i.putExtra("MODEL",model);
                getContext().startActivity(i);
            }
        });
    }
}
